package com.keelau.ui.view;

import com.keelau.idao.model.AliProduct;
import javafx.beans.property.*;
import org.springframework.beans.factory.config.ConfigurableBeanFactory;
import org.springframework.context.annotation.Scope;

import javax.inject.Inject;
import javax.inject.Named;

public class AliProductView  {

    StringProperty name;
    StringProperty proviName;
    StringProperty shopName;
    LongProperty price1;
    LongProperty price2;
    LongProperty price3;
    LongProperty start1;
    LongProperty start2;
    LongProperty start3;
    StringProperty picUrl;
    BooleanProperty isShili;
    BooleanProperty isFactory;
    BooleanProperty isSelected;
    StringProperty proUrl;

    AliProduct aliProduct;

    public AliProductView(){

    }

    public AliProductView(AliProduct aliProduct){
        this.aliProduct = aliProduct;
        this.name  = new SimpleStringProperty(aliProduct.getVcName());
        this.proviName = new SimpleStringProperty(aliProduct.getVcProvider());
        this.shopName = new SimpleStringProperty(aliProduct.getVcShopName());
        this.price1 = new SimpleLongProperty(aliProduct.getNumPrice());
        this.price2 = new SimpleLongProperty(aliProduct.getNumPrice2());
        this.price3 = new SimpleLongProperty(aliProduct.getNumPrice3());
        this.start1 = new SimpleLongProperty(aliProduct.getNumStart());
        this.start2 = new SimpleLongProperty(aliProduct.getNumStart2());
        this.start3 = new SimpleLongProperty(aliProduct.getNumStart3());
        this.picUrl = new SimpleStringProperty(aliProduct.getVcPic());
        this.isShili = new SimpleBooleanProperty(aliProduct.getIsShili()>0);
        this.isFactory = new SimpleBooleanProperty(aliProduct.getIsFactory()>0);
        this.isSelected = new SimpleBooleanProperty(aliProduct.getIsSelected()>0);
        this.proUrl = new SimpleStringProperty(aliProduct.getVcUrl());

    }

    public void setIsSelected(boolean isSelected) {
        this.isSelected.set(isSelected);
    }

    public boolean isIsSelected() {

        return isSelected.get();
    }

    public BooleanProperty isSelectedProperty() {
        return isSelected;
    }

    public boolean isIsShili() {
        return isShili.get();
    }

    public BooleanProperty isShiliProperty() {
        return isShili;
    }

    public boolean isIsFactory() {
        return isFactory.get();
    }

    public BooleanProperty isFactoryProperty() {
        return isFactory;
    }

    public void setIsShili(boolean isShili) {
        this.isShili.set(isShili);
    }

    public void setIsFactory(boolean isFactory) {
        this.isFactory.set(isFactory);
    }

    public String getName() {
        return name.get();
    }

    public StringProperty nameProperty() {
        return name;
    }

    public String getProviName() {
        return proviName.get();
    }

    public StringProperty proviNameProperty() {
        return proviName;
    }

    public String getShopName() {
        return shopName.get();
    }

    public StringProperty shopNameProperty() {
        return shopName;
    }

    public long getPrice1() {
        return price1.get();
    }

    public LongProperty price1Property() {
        return price1;
    }

    public long getPrice2() {
        return price2.get();
    }

    public LongProperty price2Property() {
        return price2;
    }

    public long getPrice3() {
        return price3.get();
    }

    public LongProperty price3Property() {
        return price3;
    }

    public void setName(String name) {
        this.name.set(name);
    }

    public void setProviName(String proviName) {
        this.proviName.set(proviName);
    }

    public void setShopName(String shopName) {
        this.shopName.set(shopName);
    }

    public void setPrice1(long price1) {
        this.price1.set(price1);
    }

    public void setPrice2(long price2) {
        this.price2.set(price2);
    }

    public void setPrice3(long price3) {
        this.price3.set(price3);
    }

    public void setStart1(long start1) {
        this.start1.set(start1);
    }

    public void setStart2(long start2) {
        this.start2.set(start2);
    }

    public void setStart3(long start3) {
        this.start3.set(start3);
    }

    public void setPicUrl(String picUrl) {
        this.picUrl.set(picUrl);
    }

    public void setAliProduct(AliProduct aliProduct) {
        this.aliProduct = aliProduct;
    }

    public long getStart1() {
        return start1.get();
    }

    public LongProperty start1Property() {
        return start1;
    }

    public long getStart2() {
        return start2.get();
    }

    public LongProperty start2Property() {
        return start2;
    }

    public long getStart3() {
        return start3.get();
    }

    public LongProperty start3Property() {
        return start3;
    }

    public String getPicUrl() {
        return picUrl.get();
    }

    public StringProperty picUrlProperty() {
        return picUrl;
    }

    public AliProduct getAliProduct() {
        return aliProduct;
    }
}
